<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>JavaScripTools Manual</title>
    <link rel="stylesheet" type="text/css" href="../../css/style.css">
</head>

<body>
<br>
<h1>JavaScripTools Manual</h1>
<h2>JavaScriptUtil</h2>
<h3>Working with arrays</h3>
<p>There are several functions to perform operations on arrays.</p>
<p>The best place to look at the 
<a href="../api/script_JavaScriptUtil.html">JavaScriptUtil API documentation</a>,
that have a complete list of functions. Here, the idea is not to replicate that
information, but to give a basic understanding.</p>
<br>
<p>The
<a href="../api/JavaScriptUtil_functions.html#indexOf">indexOf</a>,
<a href="../api/JavaScriptUtil_functions.html#inArray">inArray</a> and
<a href="../api/JavaScriptUtil_functions.html#arrayEquals">arrayEquals</a>
functions tests elements and arrays;</p>
Examples:
<pre>var letters = ["a", "b", "c", "d"];
indexOf("b") -> 1
indexOf("x") -> -1
inArray("b", letters) -> true
arrayEquals(letters, ["a", "b"]) -> false
arrayEquals(letters, ["a", "b", "c", "d"]) -> true
</pre><br>

<p>The
<a href="../api/JavaScriptUtil_functions.html#arrayConcat">arrayConcat</a> and
<a href="../api/JavaScriptUtil_functions.html#removeFromArray">removeFromArray</a>
functions return new arrays based on other arrays, by adding and removing elements.</p>
Examples:
<pre>var letters = ["a", "b", "c", "d"];
arrayConcat(letters, "e", ["f", "g"]) -> ["a", "b", "c", "d", "e", "f", "g"]
removeFromArray(letters, "b") -> ["a", "c", "d"]
removeFromArray(letters, "a", "c") -> ["b", "d"]
</pre><br>

<br><br>
<hr>
<table width="100%">
    <tr>
        <td width="33%" align="left"><b>Previous:</b><br><a href="JavaScriptUtil_objects.html">Working with objects</a></td>
        <td width="34%" align="center"><a href="index.html">Table of Contents</a></td>
        <td width="33%" align="right"><b>Next:</b><br><a href="JavaScriptUtil_dates.html">Working with dates</a></td>
    </tr>
</table>

</body>
</html>
